Skip to main content

Last Update: 2025/3/26

Kling Image Generation API

The Kling Image Generation API allows you to create images from textual descriptions using Kling's DALL-E model. This document provides an overview of the API endpoints, request parameters, and response structure.

Endpoint

POST https://platform.llmprovider.ai/v1/images/generations

Request Headers

HeaderValue
AuthorizationBearer YOUR_API_KEY
Content-Typeapplication/json

Request Body

The request body should be a JSON object with the following parameters:

ParameterTypeDescription
modelstringThe model to use for image generation.
promptstringA text description of the desired image(s).
negative_promptstring(Optional) A text description of the undesired images.
imagestring(Optional) A base64 encoded image or a image url to reference.
image_fidelitystring(Optional) Reference strength for user uploaded images during the generation process
ninteger(Optional) The number of images to generate. Defaults to 1.
aspect_ratiostring(Optional) Aspect ratio of the generated image (width:height )

Example Request

{
"model": "kling-img-v1",
"prompt": "A cute baby sea otter",
"n": 1
}

Response Body

The response body will be a JSON object containing the generated images and related metadata.

FieldTypeDescription
createdintegerThe timestamp for when the image was created.
dataarrayAn array of generated image objects.

Example Response

{
"created": 1678891234,
"data": [
{
"url": "https://..."
},
{
"url": "https://..."
}
]
}

Example Request

curl -X POST https://platform.llmprovider.ai/v1/images/generations \
-H "Authorization: Bearer $YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "kling-img-v1",
"prompt": "A cute baby sea otter",
"n": 1
}'

For any questions or further assistance, please contact us at [email protected].